<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <!-- 没有给cmessage传值，则使用默认值进行展示 -->
        <!-- <cpn :cmovies="movies"></cpn> -->
        <cpn :cmovies="movies" :cmessage="message"></cpn>
    </div>

    <template id="cpn">
        <div>
            {{cmessage}}
            <ul>
                <li v-for="item in cmovies">{{item}}</li>
            </ul>
        </div>
    </template>

    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <script>
        //父组件传子组件props
        const cpn={
            template:'#cpn',
            // props:['cmovies','cmessage'],
            props:{
                cmovies:{
                    type:Array,
                    default(){
                        return ['1','2']
                    }
                },
                cmessage:{
                    type:String,
                    //默认值
                    default:'aaaaaa',
                    //必须传值
                    required:true
                }
            },
            data(){
                return {}
            }
        }
        const app=new Vue({
            el:'#app',
            data:{
                message:'vuejs',
                movies:['海王','海贼王','海尔兄弟']
            },
            components:{
                cpn
            }
        })
    </script>
</body>
</html>